package com.xnyzc.lhy.didi.mapper.other;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xnyzc.lhy.order.entity.user.OaDUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;

public interface OaDUserMapper extends BaseMapper<OaDUser> {

    @Select("SELECT \n" +
            "duser.driver_name as driverName,\n" +
            "duser.driver_phone as driverPhone,\n" +
            "osv.veh_no as vehicleNumber,\n" +
            "vm.expand3 as vehicleTypeBrand,\n" +
            "sd.label as vehicleColor\n" +
            " FROM oa_d_user duser\n" +
            "LEFT JOIN\n" +
            "oa_d_driver_vehicle ddv\n" +
            "on duser.driver_id=ddv.driver_id\n" +
            "LEFT JOIN \n" +
            "oa_sys_vehicle osv\n" +
            "ON ddv.vehicle_id=osv.vehicle_id\n" +
            "LEFT JOIN\n" +
            "oa_sys_vehicle_mdict vm\n" +
            "on osv.`code`=vm.`code`\n" +
            "LEFT JOIN\n" +
            "oa_sys_dict sd\n" +
            "on osv.veh_color=sd.`value`\n" +
            "\n" +
            "WHERE sd.type='vegicle_color_type' AND duser.driver_id=#{driverId}")
    public HashMap<String, String> getDriverInfo(@Param("driverId") Long driverId);
}
